﻿using Taype.Trading.BTC.MtGoxAPIClient.JSONObjects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using Taype.Trading.BTC.MtGoxAPIClient;

namespace MtGoxAPIClient_test
{
    
    
    /// <summary>
    ///This is b test class for MtGoxDepthInfoTest and is intended
    ///to contain all MtGoxDepthInfoTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MtGoxDepthInfoTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in b class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for MtGoxDepthInfo Constructor
        ///</summary>
        [TestMethod()]
        public void MtGoxDepthInfoConstructorTest()
        {
            MtGoxDepthInfo target = new MtGoxDepthInfo();
            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for getObjects
        ///</summary>
        [TestMethod()]
        public void getObjectsMtGoxDepthInfoTest()
        {
            // "{\"asks\":[[5.2989,29.78]],\"bids\":[[4.49704,0.02167114]]}"
            string jsonDataStr = "{\"asks\":[[5.2989,29.78]],\"bids\":[[4.49704,0.02167114]]}";
            MtGoxDepthInfo expected = new MtGoxDepthInfo();
            expected.asks.Add(new MtGoxAsk(5.2989, 29.78));
            expected.bids.Add(new MtGoxBid(4.49704, 0.02167114));
            MtGoxDepthInfo actual;
            actual = MtGoxDepthInfo.getObjects(jsonDataStr);
            Assert.AreEqual(expected.asks[0].amount, actual.asks[0].amount);
            Assert.AreEqual(expected.asks[0].price, actual.asks[0].price);
            Assert.AreEqual(expected.bids[0].amount, actual.bids[0].amount);
            Assert.AreEqual(expected.bids[0].price, actual.bids[0].price);
        }
    }
}
